Sunday, June 14, 2015

EJEMPLOS COMO USAR ESTE REPRODUCTOR CON UN SOLO ARCHIVO DE AUDIO




Agregue código para cargar un archivo de Audio

  1. En el menú Ver , haga clic en Diseñador.
  2. Haga doble clic en el control de la carga y, a continuación, agregue el código siguiente para el controlador de eventosButton1_Click :
    ' Reset the file names for the Open File dialog box and for the Media Player.
    OpenFileDialog1.FileName = ""
    AxMediaPlayer1.FileName = ""
    ' Display the Open File dialog box.
    OpenFileDialog1.ShowDialog()
    ' Verify that Cancel was not clicked.
    If Not OpenFileDialog1.FileName = "" Then
       ' Disable the Load button.
       Button1.Enabled = False
       ' Prevent the Media Player from automatically playing loaded files.
       AxMediaPlayer1.AutoStart = False
       ' Set the Media Player audio file.
       AxMediaPlayer1.FileName = OpenFileDialog1.FileName
       MessageBox.Show("The following file has been loaded in the Media Player control: " + AxMediaPlayer1.FileName)
       ' Enable the Play button.
       Button2.Enabled = True
    Else
       ' Disable the Play button.
       Button2.Enabled = False
    End If

Agregar código para reproducir un archivo de Audio

  1. En el menú Ver , haga clic en Diseñador.
  2. Haga doble clic en el control de juego y, a continuación, agregue el código siguiente para el controlador de eventosButton2_Click :
    ' Disable the Load and the Play buttons.
    Button1.Enabled = False
    Button2.Enabled = False
    ' Play the audio file.
    AxMediaPlayer1.Play()
    ' Enable the Pause and the Stop buttons.
    Button3.Enabled = True
    Button4.Enabled = True

Agregue código para hacer una pausa de un archivo de Audio

  1. En el menú Ver , haga clic en Diseñador.
  2. Haga doble clic en el control de Pausa y, a continuación, agregue el código siguiente para el controlador de eventosButton3_Click :
    ' Disable the Pause button.
    Button3.Enabled = False
    ' Pause the audio file.
    AxMediaPlayer1.Pause()
    ' Enable the Play button.
    Button2.Enabled = True

Agregue el código para detener un archivo de Audio

  1. En el menú Ver , haga clic en Diseñador.
  2. Haga doble clic en el control Stop y, a continuación, agregue el código siguiente para el controlador de eventosButton4_Click :
    ' Disable the Pause and the Stop buttons.
    Button3.Enabled = False
    Button4.Enabled = False
    ' Stop playing the audio file, and then reset the next play position to the beginning.
    AxMediaPlayer1.Stop()
    AxMediaPlayer1.CurrentPosition = 0
    ' Enable the Load and the Play buttons.
    Button1.Enabled = True
    Button2.Enabled = True














0 comments:

Post a Comment